﻿
<FloatingToggle Title="系统配置" HeaderText="系统配置">
    <ToggleContent>

        <ul class="list-group list-group-flush">
            <li class="list-group-item">
                <Switch @bind-Value="@State.UseTabSet" OnValueChanged="@ApplySettingAsync" OnText="多标签" OffText="单页" OnColor="@Color.Success" OffColor="@Color.Secondary"></Switch> 
            </li>

            <li class="list-group-item">
                <Checkbox @bind-Value="State.ShowFooter" OnValueChanged="@ApplySettingAsync" ShowAfterLabel="true" DisplayText="显示页脚" />
            </li>
          </ul>

    </ToggleContent>
</FloatingToggle>

@code
{
    /// <summary>
    /// 当前会话状态
    /// </summary>
    [CascadingParameter]
    public SessionState State { get; set; } = new();

    /// <summary>
    /// 应用配置
    /// </summary>
    /// <param name="val"></param>
    /// <returns></returns>
    public Task ApplySettingAsync(bool val)
    {
        State.Reload(false);
        return Task.CompletedTask;
    }
}
